<html>
<%@ include file="/WEB-INF/views/include.jsp" %>

<body>
<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
google.load("jquery", "1.3");
</script>
<script src="${baseURL}/resources/js/tinymce.min.js"></script>
<script type="text/javascript">
tinymce.init({
    selector: "textarea"
 });
</script>
<script>
function sendVista(){	
	document.getElementById('vista').value='1';
	document.getElementById('publicacion').submit();
}
</script>


<div id="wrapperbody">
<div id="wrapper">

<%@ include file="/WEB-INF/views/header.jsp" %>

<div id="contentwrap">
<div id="content">

<br>
<div class="titulo"><span>Editar noticia</span></div>
<br>
<c:if test="${mensajeError != null}"> 
<div class='mensajeError'>${mensajeError}</div>
</c:if>
 <br>
<c:choose>
<c:when test="${activaVista eq '1'}">
<div class='cuadro_formulario'>
<div class='div_titulo'>Vista Previa</div>
<br>
<div class='noticia_vista'>
<c:choose>
<c:when test="${titulook ne '1'}">
<span class='campoConError'><c:out value="${tituloVista}"></c:out></span><br><br>
</c:when>
<c:otherwise>
 <div class='titulo_noticia_vista'><c:out value="${tituloVista}"></c:out></div>  
</c:otherwise>
</c:choose>
<hr>
<c:choose>
<c:when test="${urlok ne '1'}">
<br><br><span class='campoConError'><c:out value="${urlVista}"></c:out></span><br><br>
</c:when>
<c:otherwise>
<div class='imagen_noticia_vista'><img src='${urlVista}' /></div>   
</c:otherwise>
</c:choose>
<hr>
<c:choose>
<c:when test="${cuerpook ne '1'}">
<br><br><span class='campoConError'><c:out value="${cuerpoVista}"></c:out></span><br><br>
</c:when>
<c:otherwise>
<div class='cuerpo_noticia_vista'>${cuerpoVista}</div>   
</c:otherwise>
</c:choose>

</div>
<br><br>

</div>


</c:when>
</c:choose>

<br>
<form:form method="post" action="${baseURL}/noticias/edit" commandName="publicacion"> 
<form:hidden path="idpublicacion" />
<form:hidden path="idusuario" />
<div class='cuadro_formulario'>
<br>
 <table class='formulario_noticia'  >
   	
   	<tr>
   		<td width=50></td>
   		<td width=100><b>Titulo</b></td>
   		<td></td>
   		<td width=500><form:input path="titulo" /></td>  		
   	</tr>
   	<tr>
   		<td ></td>
   		<td colspan=3 style='text-align:right'><form:errors path="titulo" cssClass="campoConError"/></td>
   	</tr>
   	
   	<tr>
   		<td></td>
   		<td ><b>URL Imagen</b></td>
   		<td></td>
   		<td width=500><form:input path="urlimagen" /></td>  		
   	</tr>
   	<tr>
   		<td ></td>
   		<td colspan=3 style='text-align:right'><form:errors path="urlimagen" cssClass="campoConError"/>
   		<c:choose>
		<c:when test="${urlok ne '1'}">
   		<span class='campoConError'>${urlVista}</span>
   		</c:when>
   		</c:choose>
   		</td>
  </tr>
   	<tr>
   		<td></td>
   		<td ><b>Cuerpo</b></td>
   		<td></td>
   		<td style='text-align:right' >
   		
   		
   		
   		</td>  		
   	</tr>
   	<tr>
   	<td></td>
   		<td colspan=3  >
   		<form:textarea path="cuerpo" cols="50" rows="15" />
   		
   		
   		
   		</td>
 
   	</tr>
   	<tr>
   		<td ></td>
   		<td colspan=3 style='text-align:right'><form:errors path="cuerpo" cssClass="campoConError"/></td>
   	</tr>
</table>

<div style='width:700px;'>
  
</div>

</div>

<br><br>
 <div class='pie_botones'> 
 
<table style='text-align:center'"><tr>
<td><input type="button" value="<< Cancelar" class='button_2' onclick='location.href="../noticias"' /> </td>

<td width=600>
 <input type="button" value="Vista Previa" class='button_2' onclick='sendVista();' /> 
 &nbsp;&nbsp;&nbsp; 
 <input type="button" value="Limpiar " class='button_2' onclick='location.href="ingreso"' /> 
 &nbsp;&nbsp;&nbsp; 
  
 </td><td>
 <input type="submit" value="Actualizar Noticia >>" class='button_2' />
 </td></tr>
 </table>
 </div>
 <form:hidden path="vista"   />
 </form:form>
 <br><br>
</div>
</div> 
 
   
</div>
</div>
   <%@ include file="/WEB-INF/views/fooder.jsp" %> 
 
</body>
</html>